<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box{
            width: 300px;
            height: 300px;
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- <button v-on:click="myClick">{{flag ?"消失":"出现"}}</button> -->
        <!-- 简写 -->
        <button @click="myClick">{{flag ?"消失":"出现"}}</button>

        <div class="box" v-show="flag">

        </div>
    </div>
</body>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
    let vm = new Vue({
        el:"#app",
        data:{
            title:"消失",
            flag:true
        },
        methods: {
            myClick(){
                this.flag = !this.flag;
                console.log(this.title);
                console.log(this.flag);
                // if(this.title == "消失"){
                //     this.title = "出现"
                // }else{
                //     this.title = "消失"
                // }
            }
        },
    })
</script>
</html>